function J = PredIntegral3(twoBank, statec, StogoExp, tgoExp)
global ef N dtInt alphaLD Vup Vdown alphamax
radt = statec(1);
Vt = statec(4);
fpat = statec(5);
et = 1/radt - Vt^2/2;
num = 0;
dtIntPred = tgoExp/N;
if dtIntPred <= dtInt
    dtIntPred = dtInt;
end
absBankt = twoBank(1);
absBankf = twoBank(2);
stateLon = [radt Vt fpat StogoExp];
a = 0;
b = (absBankt - absBankf)/(et - ef);
c = absBankf - b*ef;
while 1
    V = stateLon(2);
    e = 1/stateLon(1) - stateLon(2)^2/2;
    if V > Vup
        alphar = alphamax;
    elseif V > Vdown
        alphar = (alphamax - alphaLD)*(V - Vdown)/(Vup - Vdown) + alphaLD;
    else
        alphar = alphaLD;
    end
    ctrl = [alphar a*e^2 + b*e + c];
    stateLon = RK4(@LonPredDynamic, stateLon, ctrl, dtIntPred);
    num = num + 1;
    if e >= ef % stateLon(2) <= Vf 
        break;
    end
end
tgoPred = num*dtIntPred;
F = stateLon(4);
G = tgoPred - tgoExp;
J = F^2 + G^2;
end